<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
       window.onload=function(){
            // 获取节点
        var d1=document.getElementById('d1');
        // 获取当前时间 date（）
        var now=new Date().toLocaleString();
        console.log(now,'当前时间');
        setInterval(function(){
            d1.innerHTML=new Date().toLocaleString();
        },1000)
        var back=document.getElementById('back');
        back.onclick=function(){
            history.back()
        }
       }
    </script>
</head>
<body>
    <div id="d1"></div>
    <button id="back">
        返回上一页
    </button>
</body>
</html>